package cn.net.cfss.fgbp.api.console.constant;

import cn.net.cfss.fgbp.base.constant.BaseEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 登录方式枚举
 *
 * @author yudeng
 * @since 2019-04-03
 */
public enum LoginModeEnum implements BaseEnum<LoginModeEnum, Integer> {

    USERNAME_PASSWORD(0, "用户名密码"),
    MOBILE_PASSWORD(1, "手机号密码"),
    EMAIL_PASSWORD(2, "邮箱密码"),
    WECHAT(3, "微信"),
    QQ(4, "QQ"),
    ;

    private Integer value;
    private String displayName;

    LoginModeEnum(Integer value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDisplayName() {
        return displayName;
    }

    private static Map<Integer, LoginModeEnum> enumMap = new HashMap<Integer, LoginModeEnum>();

    static {
        for (LoginModeEnum en : LoginModeEnum.values()) {
            enumMap.put(en.getValue(), en);
        }
    }

    public static LoginModeEnum getEnum(Integer value) {
        return enumMap.get(value);
    }
}
